import Vue from "vue";
import Vuex from "vuex";
import getters from "./getters";
import app from "./modules/app";
import settings from "./modules/settings";
import user from "./modules/user";
import createPersistedState from "vuex-persistedstate";
import tagsView from "./modules/tagsView";

Vue.use(Vuex);
//存储到session的模块
const PERSIST_PATHS = ["user"];

const store = new Vuex.Store({
	modules: {
		app,
		settings,
		user,
		tagsView
	},
	getters,
	// 新增规则保存vuex的值
	plugins: [
		createPersistedState({
			storage: window.sessionStorage,
			paths: PERSIST_PATHS
		})
	]
});

export default store;
